//
//  FootView.m
//  Game2048
//
//  Created by tarena on 16/3/22.
//  Copyright © 2016年 tarena. All rights reserved.
//

#import "FootView.h"

@interface FootView ()

@property (nonatomic ,strong) UIView *currentScoreBackground;
@property (nonatomic ,strong) UILabel *currentScoreHing;
@property (nonatomic ,strong) UILabel *currentScoreLB;
@property (nonatomic ,strong) UIView *highScoreBackground;
@property (nonatomic ,strong) UILabel *highScoreHing;
@property (nonatomic ,strong) UILabel *highScoreLB;


@end

@implementation FootView

-( UIView *)currentScoreBackground{
    if (!_currentScoreBackground) {
        _currentScoreBackground = [[UIView alloc]initWithFrame:CGRectMake(10, 10, 150, 80)];
        
        //允许修改形状
        _currentScoreBackground.clipsToBounds = YES;
        
        //设置圆角弧度
        _currentScoreBackground.layer.cornerRadius = 5;
        
        //背景色
        _currentScoreBackground.backgroundColor = [UIColor colorWithWhite:0.5 alpha:1.0];
        
    }
    return _currentScoreBackground;
}

-( UILabel *)currentScoreHing{
    if (!_currentScoreHing) {
        _currentScoreHing = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 150, 35)];
        _currentScoreHing.textAlignment = NSTextAlignmentCenter;
        _currentScoreHing.font = [UIFont fontWithName:@"ArialHebrew-Bold" size:20];
        _currentScoreHing.textColor = [UIColor whiteColor];
        _currentScoreHing.text = @"currentScore";
    }
    return _currentScoreHing;
}

-( UILabel *)currentScoreLB{
    if (!_currentScoreLB) {
        _currentScoreLB = [[UILabel alloc]initWithFrame:CGRectMake(10, 45, 150, 44)];
        _currentScoreLB.textAlignment = NSTextAlignmentCenter;
        _currentScoreLB.font = [UIFont fontWithName:@"Palatino-Bold" size:35];
        _currentScoreLB.textColor = [UIColor orangeColor];
        
    }
    return _currentScoreLB;
}

-( UIView *)highScoreBackground{
    if (!_highScoreBackground) {
        _highScoreBackground = [[UIView alloc]initWithFrame:CGRectMake(self.bounds.size.width - 150, 10, 130, 80)];
        
        //允许修改形状
        _highScoreBackground.clipsToBounds = YES;
        
        //设置圆角弧度
        _highScoreBackground.layer.cornerRadius = 5;
        
        //背景色
        _highScoreBackground.backgroundColor = [UIColor colorWithWhite:0.5 alpha:1.0];
    }
    return _highScoreBackground;
}


-( UILabel *)highScoreHing{
    if (!_highScoreHing) {
        _highScoreHing = [[UILabel alloc]initWithFrame:CGRectMake(self.frame.size.width - 160, 10, 150, 35)];
        _highScoreHing.textAlignment = NSTextAlignmentCenter;
        _highScoreHing.font = [UIFont fontWithName:@"ArialHebrew-Bold" size:20];
        _highScoreHing.textColor = [UIColor whiteColor];
        _highScoreHing.text = @"highScore";
        
    }
    return _highScoreHing;
}


-( UILabel *)highScoreLB{
    if (!_highScoreLB) {
        _highScoreLB = [[UILabel alloc]initWithFrame:CGRectMake(self.frame.size.width-160, 45, 150, 44)];
        _highScoreLB.textAlignment = NSTextAlignmentCenter;
        _highScoreLB.font = [UIFont fontWithName:@"Palatino-Bold" size:35];
        _highScoreLB.textColor = [UIColor orangeColor];
        
    }
    return _highScoreLB;
}

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self addSubview:self.currentScoreBackground];
        [self addSubview:self.highScoreBackground];
        [self addSubview:self.currentScoreHing];
        [self addSubview:self.currentScoreLB];
        [self addSubview:self.highScoreHing];
        [self addSubview:self.highScoreLB];
        [self setHightScore:100];
        [self setCurrentScore:0];
    }
    return self;
}


-(void)setHightScore:(UInt32)score{
    _highScoreLB.text = [NSString stringWithFormat:@"%d",score];
    
}

-(void)setCurrentScore:(UInt32)score{
    _currentScoreLB.text = [NSString stringWithFormat:@"%d",score];
}

@end
